
import 'package:freezed_annotation/freezed_annotation.dart';

import 'package:json_annotation/json_annotation.dart';

part 'address_detail_entity.g.dart';
@JsonSerializable()
class AddressDetailEntity {
  String? addTime;
  String? city;
  String? county;
  String? updateTime;
  int? userId;
  String? areaCode;
  bool? isDefault;
  String? addressDetail;
  bool? deleted;
  String? province;
  String? name;
  String? tel;
  int? id;

  AddressDetailEntity({
    this.addTime,
    this.city,
    this.county,
    this.updateTime,
    this.userId,
    this.areaCode,
    this.isDefault,
    this.addressDetail,
    this.deleted,
    this.province,
    this.name,
    this.tel,
    this.id,
  });

  //位置
  String get addressArea {
    return (province ?? '') + (city ?? '') + (county ?? '');
  }

  factory AddressDetailEntity.fromJson(Map<String, dynamic> json) => _$AddressDetailEntityFromJson(json);
  
  Map<String, dynamic> toJson() => _$AddressDetailEntityToJson(this);
}